<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>订单管理管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			//$("#name").focus();
			$("#inputForm").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
		});
		function tiao(){
			var code=$("#codes").val();
			var storeCode=$("#storeCode").val();
			window.location.href="${ctx}/sys/orders/confirmGoodsNum?code="+code+"&storeCode="+storeCode
		}
		
		$(function(){
			$("#transportType").attr("disabled","disabled").css("background-color","#EEEEEE;");
			$("#payType").attr("disabled","disabled").css("background-color","#EEEEEE;");
			$("#state").attr("disabled","disabled").css("background-color","#EEEEEE;");
		})
		
		
	</script>
</head>
<body>
    <input value="${code }" id="codes" type="hidden"/>
    <input value="${storeCode }" id="storeCode" type="hidden"/>
	<ul class="nav nav-tabs">
		<li><a href="${ctx}/sys/orders/handleOrderList">待处理订单列表</a></li>
		<li class="active"><a href="javascript:void(0)">待处理订单<shiro:hasPermission name="sys:orders:edit">${not empty orders.id?'发货':'添加'}</shiro:hasPermission><shiro:lacksPermission name="sys:orders:edit">查看</shiro:lacksPermission></a></li>
	</ul><br/>
	<form:form id="inputForm" modelAttribute="orders" action="${ctx}/sys/orders/save" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<sys:message content="${message}"/>		
		<div class="control-group">
			<label class="control-label">订单编号：</label>
			<div class="controls">
				<form:input path="code" htmlEscape="false" maxlength="30" class="input-xlarge " readonly="true"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">订单状态：</label>
			<div class="controls">
				<form:select id="state" path="state" class="input-medium" >
			    <form:options items="${fns:getDictList('orders_state')}" htmlEscape="false" itemValue="value" itemLabel="label"  /></form:select>
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label">下单时间：</label>
			<div class="controls">
				   <input name="createDate" type="text" readonly="readonly" value="<fmt:formatDate value="${orders.createDate }" pattern="yyyy-MM-dd HH:mm:ss"/>" /> 
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label">物流方式：</label>
			<div class="controls">
				<form:select id="transportType" path="transportType" class="input-medium" >
			    <form:options items="${fns:getDictList('transport_type')}" htmlEscape="false" itemValue="value" itemLabel="label"  /></form:select>
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label">收货人：</label>
			<div class="controls">
				<form:input path="receiveName" htmlEscape="false" maxlength="50" class="input-xlarge " readonly="true"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">支付方式:</label>
			<div class="controls">
				<form:select id="payType" path="payType" class="input-medium" >
			    <form:options items="${fns:getDictList('pay_type')}" htmlEscape="false" itemValue="value" itemLabel="label"  /></form:select>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">支付流水号:</label>
			<div class="controls">
				<form:input path="payNo" htmlEscape="false" maxlength="11" class="input-xlarge " readonly="true"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">下单门店:</label>
			<div class="controls">
				<form:input path="buyStoreName" htmlEscape="false" maxlength="11" class="input-xlarge " readonly="true"/>
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label">公司名称:</label>
			<div class="controls">
				<form:input path="company" htmlEscape="false" maxlength="11" class="input-xlarge " readonly="true"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">纳税人识别号:</label>
			<div class="controls">
				<form:input path="dutyCode" htmlEscape="false" maxlength="11" class="input-xlarge " readonly="true"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">发票邮寄地址:</label>
			<div class="controls">
				<form:input path="fpReceiveAddress" htmlEscape="false" maxlength="11" class="input-xlarge " readonly="true"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">发票接收人:</label>
			<div class="controls">
				<form:input path="fpReceiveName" htmlEscape="false" maxlength="11" class="input-xlarge " readonly="true"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">联系电话:</label>
			<div class="controls">
				<form:input path="fpReceivePhone" htmlEscape="false" maxlength="11" class="input-xlarge " readonly="true"/>
			</div>
		</div>
		
		<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>序号</th>
				<th>商品名称</th>
				<th>配件编号</th>
				<th>单价</th>
				<th>数量</th>
				<th>已发数量</th>
				<th>剩余数量</th>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${orderDetail}" var="orderDetail" varStatus="status">
			<tr>
			    <td>${status.index+1}</td>
			    <td>${orderDetail.goodsCnName }</td>
			    <td>${orderDetail.partsCode }</td>
			    <td>${orderDetail.price }</td>
			    <td>${orderDetail.num }</td>
			    <td>${orderDetail.fhNum }</td>
			    <td>${orderDetail.yuNum }</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
		<div class="form-actions">
		    <input id="btnSubmit" class="btn btn-primary" type="button" value="发货" onclick="tiao()"/>
			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
		</div>
	</form:form>
</body>
</html>